home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / internet / envoy / netprobe_4_24.lha / NetProbe / src / Envoy.c next >
Encoding:
C/C++ Source or Header  |  1994-09-10  |  18.1 KB  |  859 lines

  1. //
  2. //  $Log: Envoy.c,v $
  3. //  Revision 1.5  1994/09/10  14:31:36  hakan
  4. //  Sch...  Wenn die MATCH_HOSTNAME sagen meinen die auch
  5. //  HOSTNAME und nicht REALMNAME:HOSTNAME
  6. //
  7. //  Revision 1.4  1994/08/15  22:22:14  hakan
  8. //  'Stop Scanning' actually works now :-)
  9. //
  10. //  Revision 1.3  1994/07/12  23:10:46  hakan
  11. //  Should be finished
  12. //
  13. //  Revision 1.2  1994/06/19  15:42:39  hakan
  14. //  Starting,  tells whether we can hope for a realm server or not
  15. //
  16. //  Revision 1.1  1994/06/19  15:24:02  hakan
  17. //  Initial revision
  18. //
  19. //
  20.  
  21. static char* RCSId = "$Id: Envoy.c,v 1.5 1994/09/10 14:31:36 hakan Exp $";
  22.  
  23.  
  24.  
  25. #include "extern.h"
  26.  
  27.  
  28.  
  29. static long         ScanBlock;
  30. static long         _RealmCount;
  31. static struct List  _RealmList;
  32. static struct List  _HostList;
  33. static struct Hook  h;
  34. static ULONG        NIPCRetVal;
  35. static BOOL         KeepScanning;
  36. static BOOL         Kludge402;
  37.  
  38. static void ClearRealmList (void);
  39. static void ClearHostList (void);
  40. static void SortAllLists (void);
  41. static void SortList (struct List* list);
  42.  
  43. static void DoScanHosts (char* realm);
  44. static void StartInquiryA (APTR Tags);
  45. __saveds static ULONG ASM hookEntry(REG(a0) struct Hook *h, REG(a2) VOID *o, REG(a1) VOID *msg);
  46. __saveds static ULONG DecodeNIPCInquiry (struct Hook *h, VOID *o, VOID *msg);
  47.  
  48. #ifdef SERIAL_DEBUGGING
  49.     #define D(x)    x
  50.     extern KPrintF (char* format, ...);
  51. #else
  52.     #define D(x)
  53. #endif
  54.  
  55.  
  56.  
  57. //
  58. //  Publicly accessable functions
  59. //
  60.  
  61.  
  62.  
  63. BOOL CreateEnvoy (void)
  64. {
  65.     NewList (&_RealmList);
  66.     NewList (&_HostList);
  67.  
  68.     h.h_Entry       = (ULONG (*)()) hookEntry;
  69.     h.h_SubEntry    = DecodeNIPCInquiry;
  70.     h.h_Data        = NULL;
  71.  
  72.     return (TRUE);
  73. }
  74.  
  75.  
  76.  
  77. void DestroyEnvoy (void)
  78. {
  79.     ClearRealmList ();
  80.     ClearHostList ();
  81. }
  82.  
  83.  
  84.  
  85. BOOL RealmServerRunning (void)
  86. {
  87.     char            HostName [MAXNAME+1];
  88.     struct Entity*  local;
  89.     BOOL            running = FALSE;
  90.  
  91.  
  92.     if (local = CreateEntity (TAG_END))
  93.     {
  94.         if (GetHostName (local, HostName, sizeof (HostName) - 1))
  95.         {
  96.             if (strchr (HostName, ':'))
  97.             {
  98.                 running = TRUE;
  99.             }
  100.         }
  101.         
  102.         DeleteEntity (local);
  103.     }
  104.  
  105.  
  106.     return (running);
  107. }
  108.  
  109.  
  110.  
  111. struct List* Hosts (void)
  112. {
  113.     return (&_HostList);
  114. }
  115.  
  116.  
  117.  
  118. struct List* Realms (void)
  119. {
  120.     return (&_RealmList);
  121. }
  122.  
  123.  
  124.  
  125. Host* getHost (char* name)
  126. {
  127.     return ((Host*) FindName (&_HostList, name));
  128. }
  129.  
  130.  
  131.  
  132. //
  133. //  Here come various flavors of 'ScanFoo'-functions...
  134. //
  135.  
  136.  
  137.  
  138. void ScanRealms (void)
  139. {
  140.     struct TagItem queryTags[] =
  141.     {
  142.         QUERY_REALMS,   0,
  143.         TAG_END,        0,
  144.     };
  145.  
  146.  
  147.     ClearRealmList ();
  148.     if (OpenScanWindow (NP_ScanTime * 5))
  149.     {
  150.         ScanBlock = 0;
  151.         StartInquiryA (&queryTags);
  152.         CloseScanWindow ();
  153.     }
  154.     SortAllLists ();
  155. }
  156.  
  157.  
  158.  
  159. void ScanHosts (char* realmname)
  160. {
  161.     ClearHostList ();
  162.     if (OpenScanWindow (NP_ScanTime * 5))
  163.     {
  164.         ScanBlock = 0;
  165.         DoScanHosts (realmname);
  166.         CloseScanWindow ();
  167.     }
  168.     SortAllLists ();
  169. }
  170.  
  171.  
  172.  
  173. void ScanAll (void)
  174. {
  175.     struct TagItem queryTags[] =
  176.     {
  177.         QUERY_REALMS,   0,
  178.         TAG_END,        0,
  179.     };
  180.  
  181.  
  182.     ClearRealmList ();
  183.     if (OpenScanWindow (NP_ScanTime * 5))
  184.     {
  185.         KeepScanning = TRUE;
  186.         ScanBlock = 0;
  187.         StartInquiryA (&queryTags);
  188.         if (_RealmCount)
  189.         {
  190.             if (OpenScanWindow (_RealmCount * NP_ScanTime * 5))
  191.             {
  192.                 struct Node* realm;
  193.  
  194.                 for (realm = _RealmList.lh_Head; realm->ln_Succ; realm = realm->ln_Succ)
  195.                 {
  196.                     if (KeepScanning)
  197.                     {
  198.                         DoScanHosts (realm->ln_Name);
  199.                         ScanBlock += 5 * NP_ScanTime;
  200.                     }
  201.                 }
  202.             }
  203.         }
  204.  
  205.         CloseScanWindow ();
  206.     }
  207.     SortAllLists ();
  208. }
  209.  
  210.  
  211.  
  212. void ScanPing (void)
  213. {
  214.     ClearHostList ();
  215.     if (OpenScanWindow (NP_ScanTime * 5))
  216.     {
  217.         ScanBlock = 0;
  218.         DoScanHosts (NULL);
  219.         CloseScanWindow ();
  220.     }
  221.     SortAllLists ();
  222. }
  223.  
  224.  
  225.  
  226. static void DoScanHosts (char* realm)
  227. {
  228.     long n = 0;
  229.     struct TagItem queryTags [100];
  230.  
  231.  
  232.  
  233.     //
  234.     //  Do we need our filter-kludge?
  235.     //
  236.  
  237.     if (NP_Config & NP_402_Kludge)
  238.     {
  239.         Kludge402 = TRUE;
  240.     }
  241.     else
  242.     {
  243.         Kludge402 = FALSE;
  244.     }
  245.  
  246.  
  247.     //
  248.     //  Build the Tag array
  249.     //
  250.  
  251.     //
  252.     //  We ALWAYS want to hear our Hostname
  253.     //
  254.  
  255.     queryTags [n].ti_Tag    = (ULONG) QUERY_HOSTNAME;
  256.     queryTags [n].ti_Data   = (ULONG) 0;
  257.     n++;
  258.  
  259.  
  260.     //
  261.     //  Special Barnard Request
  262.     //
  263.  
  264.     if (NP_Config & NP_SingleHost)
  265.     {
  266.         char* banane = strchr (NP_ScanHost, ':');
  267.         
  268.         queryTags [n].ti_Tag    = (ULONG) MATCH_HOSTNAME;
  269.         queryTags [n].ti_Data   = (ULONG) (banane ? (banane+1) : NP_ScanHost);
  270.         n++;
  271.     }
  272.  
  273.  
  274.     //
  275.     //  Maybe a realm,  too?
  276.     //
  277.  
  278.     if (realm)
  279.     {
  280.         queryTags [n].ti_Tag  = (ULONG) MATCH_REALM;
  281.         queryTags [n].ti_Data = (ULONG) realm;
  282.         n++;
  283.     }
  284.  
  285.  
  286.     //
  287.     //  Whom does this Host belong?
  288.     //
  289.  
  290.     if (NP_Config & NP_Owner)
  291.     {
  292.         queryTags [n].ti_Tag    = (ULONG) QUERY_OWNER;
  293.         queryTags [n].ti_Data   = (ULONG) 0;
  294.         n++;
  295.     }
  296.  
  297.  
  298.     //
  299.     //  What IP-Adress do we have?  (Might not be supported in later versions)
  300.     //
  301.  
  302.     if (NP_Config & NP_IPAddr)
  303.     {
  304.         queryTags [n].ti_Tag    = (ULONG) QUERY_IPADDR;
  305.         queryTags [n].ti_Data   = (ULONG) 0;
  306.         n++;
  307.     }
  308.  
  309.  
  310.     //
  311.     //  Tell us your Kickstart-version
  312.     //
  313.  
  314.     if (NP_Config & NP_KickVersion)
  315.     {
  316.         queryTags [n].ti_Tag    = (ULONG) QUERY_KICKVERSION;
  317.         queryTags [n].ti_Data   = (ULONG) 0;
  318.         n++;
  319.     }
  320.  
  321.  
  322.     //
  323.     //  Tell your Workbench, too
  324.     //
  325.  
  326.     if (NP_Config & NP_WBVersion)
  327.     {
  328.         queryTags [n].ti_Tag    = (ULONG) QUERY_WBVERSION;
  329.         queryTags [n].ti_Data   = (ULONG) 0;
  330.         n++;
  331.     }
  332.  
  333.  
  334.     //
  335.     //  Some might care about the NIPC-Library
  336.     //
  337.  
  338.     if (NP_Config & NP_NIPCVersion)
  339.     {
  340.         queryTags [n].ti_Tag    = (ULONG) QUERY_NIPCVERSION;
  341.         queryTags [n].ti_Data   = (ULONG) 0;
  342.         n++;
  343.     }
  344.  
  345.  
  346.     //
  347.     //  What kind of Fast Memory do we have?
  348.     //
  349.  
  350.     if (NP_Config & NP_MaxFastMem)
  351.     {
  352.         queryTags [n].ti_Tag    = (ULONG) QUERY_MAXFASTMEM;
  353.         queryTags [n].ti_Data   = (ULONG) 0;
  354.         n++;
  355.     }
  356.  
  357.     if (NP_Config & NP_AvailFastMem)
  358.     {
  359.         queryTags [n].ti_Tag    = (ULONG) QUERY_AVAILFASTMEM;
  360.         queryTags [n].ti_Data   = (ULONG) 0;
  361.         n++;
  362.     }
  363.  
  364.  
  365.     //
  366.     //  What kind of Chip Memory do we have?
  367.     //
  368.  
  369.     if (NP_Config & NP_MaxChipMem)
  370.     {
  371.         queryTags [n].ti_Tag    = (ULONG) QUERY_MAXCHIPMEM;
  372.         queryTags [n].ti_Data   = (ULONG) 0;
  373.         n++;
  374.     }
  375.  
  376.     if (NP_Config & NP_AvailChipMem)
  377.     {
  378.         queryTags [n].ti_Tag    = (ULONG) QUERY_AVAILCHIPMEM;
  379.         queryTags [n].ti_Data   = (ULONG) 0;
  380.         n++;
  381.     }
  382.  
  383.  
  384.     //
  385.     //  How about our Processor / FPU
  386.     //
  387.  
  388.     if (NP_Config & NP_ATTNFlags)
  389.     {
  390.         queryTags [n].ti_Tag    = (ULONG) QUERY_ATTNFLAGS;
  391.         queryTags [n].ti_Data   = (ULONG) 0;
  392.         n++;
  393.     }
  394.  
  395.  
  396.     //
  397.     //  What Custom chips do we have?
  398.     //
  399.  
  400.     if (NP_Config & NP_ChipRevBits)
  401.     {
  402.         queryTags [n].ti_Tag    = (ULONG) QUERY_CHIPREVBITS;
  403.         queryTags [n].ti_Data   = (ULONG) 0;
  404.         n++;
  405.     }
  406.  
  407.  
  408.     //
  409.     //  Show us all your Services
  410.     //
  411.  
  412.     if (NP_Config & NP_Services)
  413.     {
  414.         queryTags [n].ti_Tag    = (ULONG) QUERY_SERVICE;
  415.         queryTags [n].ti_Data   = (ULONG) 0;
  416.         n++;
  417.     }
  418.  
  419.  
  420.     //
  421.     //  Show all your Entities, too
  422.     //
  423.  
  424.     if (NP_Config & NP_Entities)
  425.     {
  426.         queryTags [n].ti_Tag    = (ULONG) QUERY_ENTITY;
  427.         queryTags [n].ti_Data   = (ULONG) 0;
  428.         n++;
  429.     }
  430.  
  431.  
  432.     //
  433.     //  Simply clean up
  434.     //
  435.  
  436.     queryTags [n].ti_Tag        = (ULONG) TAG_END;
  437.     queryTags [n].ti_Data       = (ULONG) 0;
  438.  
  439.  
  440.     //
  441.     //  Start the Inquiry
  442.     //
  443.  
  444.     StartInquiryA ((APTR) &queryTags);
  445. }
  446.  
  447.  
  448.  
  449. //
  450. //  Everything from here on is private...
  451. //  First my Exec-list-handling functions
  452. //
  453.  
  454.  
  455.  
  456. static void ClearRealmList (void)
  457. {
  458.     struct Node* work;
  459.     struct Node* next;
  460.  
  461.     if (!(IsListEmpty (&_RealmList)))
  462.     {
  463.         work = _RealmList.lh_Head;
  464.         while (next = work->ln_Succ)
  465.         {
  466.             FreeMem (work, sizeof (Realm));
  467.             work = next;
  468.         }
  469.     }
  470.  
  471.     NewList (&(_RealmList));
  472.     _RealmCount = 0;
  473. }
  474.  
  475.  
  476.  
  477. static void ClearHostList (void)
  478. {
  479.     struct Node* work;
  480.     struct Node* next;
  481.  
  482.     struct Node* innerwork;
  483.     struct Node* innernext;
  484.  
  485.     Host*       innerhost;
  486.  
  487.  
  488.     if (!(IsListEmpty (&_HostList)))
  489.     {
  490.         work = _HostList.lh_Head;
  491.         while (next = work->ln_Succ)
  492.         {
  493.             innerhost = (Host*) work;
  494.  
  495.             if (!(IsListEmpty (&(innerhost->Entities))))
  496.             {
  497.                 innerwork = innerhost->Entities.lh_Head;
  498.                 while (innernext = innerwork->ln_Succ)
  499.                 {
  500.                     FreeMem (innerwork, sizeof (String));
  501.                     innerwork = innernext;
  502.                 }
  503.             }
  504.  
  505.             if (!(IsListEmpty (&(innerhost->Services))))
  506.             {
  507.                 innerwork = innerhost->Services.lh_Head;
  508.                 while (innernext = innerwork->ln_Succ)
  509.                 {
  510.                     FreeMem (innerwork, sizeof (String));
  511.                     innerwork = innernext;
  512.                 }
  513.             }
  514.  
  515.             FreeMem (work, sizeof (Host));
  516.             work = next;
  517.         }
  518.     }
  519.  
  520.     NewList (&(_HostList));
  521.     //  HostCount = 0;
  522. }
  523.  
  524.  
  525.  
  526. static void SortAllLists (void)
  527. {
  528.     if (!(IsListEmpty (&_RealmList)))
  529.     {
  530.         SortList (&_RealmList);
  531.     }
  532.  
  533.  
  534.     if (!(IsListEmpty (&_HostList)))
  535.     {
  536.         struct Node*    work;
  537.         struct List*    list;
  538.  
  539.         SortList (&_HostList);
  540.  
  541.         for (work = (struct Node*) _HostList.lh_Head; work->ln_Succ; work = work->ln_Succ)
  542.         {
  543.             list = (struct List*) (&((Host*) work)->Services);
  544.  
  545.             if (!(IsListEmpty (list)))
  546.             {
  547.                 SortList (list);
  548.             }
  549.  
  550.             list = (struct List*) (&((Host*) work)->Entities);
  551.  
  552.             if (!(IsListEmpty (list)))
  553.             {
  554.                 SortList (list);
  555.             }
  556.         }
  557.     }
  558. }
  559.  
  560.  
  561.  
  562. //
  563. //  This one is courtesy of Henning Schmiedehausen
  564. //
  565.  
  566.  
  567.  
  568. static void SortList (struct List* list)
  569. {
  570.     struct Node* mynode;
  571.     struct Node* my2node;
  572.     BOOL         sorted;
  573.  
  574.     do
  575.     {
  576.         sorted = TRUE;
  577.         for (mynode = (struct Node*) list->lh_Head; mynode->ln_Succ; mynode = mynode->ln_Succ)
  578.         {
  579.             if (mynode->ln_Succ->ln_Succ)
  580.             {
  581.                 if (strcmp (mynode->ln_Name, mynode->ln_Succ->ln_Name) > 0)
  582.                 {
  583.                     my2node = mynode->ln_Succ;
  584.  
  585.                     Remove (my2node);
  586.  
  587.                     my2node->ln_Pred         = mynode->ln_Pred;
  588.                     my2node->ln_Succ         = mynode;
  589.  
  590.                     mynode->ln_Pred->ln_Succ = my2node;
  591.                     mynode->ln_Pred          = my2node;
  592.  
  593.                     sorted = FALSE;
  594.                 }
  595.             }
  596.         }
  597.     }
  598.     while (!sorted);
  599. }
  600.  
  601.  
  602.  
  603. //
  604. //  Here goes real nipc stuff
  605. //
  606.  
  607.  
  608.  
  609. static void StartInquiryA (APTR Tags)
  610. {
  611.     NIPCRetVal = TRUE;
  612.  
  613.     if (NIPCInquiryA (&h, NP_ScanTime, NP_ScanPackets, Tags))
  614.     {
  615.         long i;
  616.  
  617.         for (i=0; i<NP_ScanTime*5; i++)
  618.         {
  619.             if (ShowScan (ScanBlock + i))
  620.             {
  621.                 i = NP_ScanTime * 5;
  622.                 KeepScanning = FALSE;
  623.             }
  624.         }
  625.     }
  626.     else
  627.     {
  628.         DisplayBeep (NULL);
  629.     }
  630.  
  631.     //
  632.     //  Tell nipc to stop sending packets...
  633.     //
  634.  
  635.     NIPCRetVal = FALSE;
  636. }
  637.  
  638.  
  639.  
  640. __saveds static ULONG ASM hookEntry(REG(a0) struct Hook *h, REG(a2) VOID *o, REG(a1) VOID *msg)
  641. {
  642.     return ((*(ULONG (*)(struct Hook *,VOID *,VOID *))(h->h_SubEntry))(h, o, msg));
  643. }
  644.  
  645.  
  646.  
  647. __saveds static ULONG DecodeNIPCInquiry (struct Hook *h, VOID *o, VOID *msg)
  648. {
  649.     String*         string;
  650.     Realm*          realm;
  651.     Host*           host;
  652.  
  653.     struct TagItem* tstate;
  654.     struct TagItem* tag;
  655.  
  656.     D (KPrintF ("DecodeNIPCInquiry() entered\n"));
  657.  
  658.  
  659.     //
  660.     //  The 'Object' is the address of the NetProbe Task.
  661.     //  I've got no use for this...
  662.     //
  663.  
  664.     //  if (o)
  665.     //  {
  666.     //  }
  667.  
  668.  
  669.     //
  670.     //  Here goes the 40.2-Kludge
  671.     //
  672.  
  673.     if (Kludge402)
  674.     {
  675.         tstate = (struct TagItem*) msg;
  676.  
  677.         while (tag = NextTagItem (&tstate))
  678.         {
  679.             if (tag->ti_Tag ==  QUERY_NIPCVERSION)
  680.             {
  681.                 if (tag->ti_Data < ((40 << 16) | 2))
  682.                 {
  683.                     return TRUE;
  684.                 }
  685.             }
  686.         }
  687.     }
  688.  
  689.  
  690.     //
  691.     //  Now, we need out working Host
  692.     //
  693.  
  694.     tstate = (struct TagItem*) msg;
  695.  
  696.     while (tag = NextTagItem (&tstate))
  697.     {
  698.         if (tag->ti_Tag == QUERY_HOSTNAME)
  699.         {
  700.             if (!(host = (Host*) FindName (&(_HostList), (char*) tag->ti_Data)))
  701.             {
  702.                 if (!(host = (Host*) AllocMem (sizeof (Host), MEMF_PUBLIC | MEMF_CLEAR)))
  703.                 {
  704.                     return FALSE;
  705.                 }
  706.  
  707.                 strcpy (host->HostName, (char*) tag->ti_Data);
  708.                 host->h_node.ln_Name = host->HostName;
  709.  
  710.                 AddHead (&(_HostList), host);
  711.  
  712.                 //  HostCount++;
  713.  
  714.                 NewList (&(host->Entities));
  715.                 NewList (&(host->Services));
  716.             }
  717.         }
  718.     }
  719.  
  720.  
  721.     //
  722.     //  Now, we fill in our real data
  723.     //
  724.  
  725.     tstate = (struct TagItem*) msg;
  726.  
  727.     while (tag = NextTagItem (&tstate))
  728.     {
  729.         ULONG tidata = tag->ti_Data;
  730.  
  731.         switch (tag->ti_Tag)
  732.         {
  733.             case QUERY_IPADDR:
  734.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_IPADDR: '%ld.%ld.%ld.%ld'\n", ((tidata >> 24) & 0xff), ((tidata >> 16) & 0xff), ((tidata >> 8) & 0xff), (tidata & 0xff)));
  735.                 host->IPAddr = tidata;
  736.                 break;
  737.  
  738.             case QUERY_REALMS:
  739.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_REALMS: '%s'\n", (char*) tidata));
  740.                 if (!(realm = (Realm*) FindName (&(_RealmList), (char*) tidata)))
  741.                 {
  742.                     if (!(realm = AllocMem (sizeof (Realm), MEMF_PUBLIC|MEMF_CLEAR)))
  743.                     {
  744.                         return FALSE;
  745.                     }
  746.  
  747.                     strcpy (realm->RealmName, (char*) tidata);
  748.                     realm->r_node.ln_Name = realm->RealmName;
  749.  
  750.                     D (KPrintF ("DecodeNIPCInquiry:: '%s' added\n", realm->RealmName));
  751.                     AddHead (&(_RealmList), realm);
  752.  
  753.                     _RealmCount++;
  754.                 }
  755.                 break;
  756.  
  757.             case QUERY_HOSTNAME:
  758.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_HOSTNAME: '%s'\n", (char*) tidata));
  759.                 break;
  760.  
  761.             case QUERY_SERVICE:
  762.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_SERVICE: '%s'\n", (char*) tidata));
  763.                 if (!(string = (String*) FindName (&(host->Services), (char*) tidata)))
  764.                 {
  765.                     if (!(string = AllocMem (sizeof (String), MEMF_PUBLIC | MEMF_CLEAR)))
  766.                     {
  767.                         return FALSE;
  768.                     }
  769.  
  770.                     strcpy (string->String, (char*) tidata);
  771.                     string->t_node.ln_Name = string->String;
  772.                     AddTail (&(host->Services), string);
  773.                 }
  774.                 break;
  775.  
  776.             case QUERY_ENTITY:
  777.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_ENTITY: '%s'\n", (char*) tidata));
  778.                 if (!(string = (String*) FindName (&(host->Entities), (char*) tidata)))
  779.                 {
  780.                     if (!(string = AllocMem (sizeof (String), MEMF_PUBLIC | MEMF_CLEAR)))
  781.                     {
  782.                         return FALSE;
  783.                     }
  784.  
  785.                     strcpy (string->String, (char*) tidata);
  786.                     string->t_node.ln_Name = string->String;
  787.                     AddTail (&(host->Entities), string);
  788.                 }
  789.                 break;
  790.  
  791.             case QUERY_OWNER:
  792.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_OWNER: '%s'\n", (char*) tidata));
  793.                 strcpy (host->Owner, (char*) tidata);
  794.                 break;
  795.  
  796.             case QUERY_MACHDESC:
  797.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_MACHDESC: '%08lx'\n", tidata));
  798.                 break;
  799.  
  800.             case QUERY_ATTNFLAGS:
  801.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_ATTNFLAGS: '%08lx'\n", tidata));
  802.                 host->ATTNFlags = tidata;
  803.                 break;
  804.  
  805.             case QUERY_LIBVERSION:
  806.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_LIBVERSION: '%08lx'\n", tidata));
  807.                 break;
  808.  
  809.             case QUERY_CHIPREVBITS:
  810.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_CHIPREVBITS: '%08lx'\n", tidata));
  811.                 host->ChipRevBits = tidata;
  812.                 break;
  813.  
  814.             case QUERY_MAXFASTMEM:
  815.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_MAXFASTMEM: '%8ld'\n", tidata));
  816.                 host->MaxFastMem = tidata;
  817.                 break;
  818.  
  819.             case QUERY_AVAILFASTMEM:
  820.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_AVAILFASTMEM: '%8ld'\n", tidata));
  821.                 host->AvailChipMem = tidata;
  822.                 break;
  823.  
  824.             case QUERY_MAXCHIPMEM:
  825.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_MAXCHIPMEM: '%8ld'\n", tidata));
  826.                 host->MaxChipMem = tidata;
  827.                 break;
  828.  
  829.             case QUERY_AVAILCHIPMEM:
  830.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_AVAILCHIPMEM: '%8ld'\n", tidata));
  831.                 host->AvailChipMem = tidata;
  832.                 break;
  833.  
  834.             case QUERY_KICKVERSION:
  835.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_KICKVERSION: '%ld.%ld'\n", ((tidata >> 16) & 0xff), (tidata & 0xff)));
  836.                 host->KickVersion = tidata;
  837.                 break;
  838.  
  839.             case QUERY_WBVERSION:
  840.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_WBVERSION: '%ld.%ld'\n", ((tidata >> 16) & 0xff), (tidata & 0xff)));
  841.                 host->WBVersion = tidata;
  842.                 break;
  843.  
  844.             case QUERY_NIPCVERSION:
  845.                 D (KPrintF ("DecodeNIPCInquiry::QUERY_NIPCVERSION: '%ld.%ld'\n", ((tidata >> 16) & 0xff), (tidata & 0xff)));
  846.                 host->NIPCVersion = tidata;
  847.                 break;
  848.  
  849.             default:
  850.                 break;
  851.         }
  852.     }
  853.     
  854.  
  855.     D (KPrintF ("DecodeNIPCInquiry() left\n\n"));
  856.  
  857.     return NIPCRetVal;
  858. }
  859.